//
//  OuptPrescListCell.m
//  掌上宏力
//
//  Created by admin on 2017/5/15.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "OuptPrescListCell.h"
#import "OuptPrescListModel.h"

#define LabFont 14
#define Lab_W 73
#define Text_W 45
#define TextFont 15
#define Height 30

@interface OuptPrescListCell ()
/*
 //VISIT_NO
 @property (nonatomic,copy) NSString *visitNo;
 //DEPT_NAME
 @property (nonatomic,copy) NSString *depeName;
 //DOCTOR
 @property (nonatomic,copy) NSString *doctor;
 //药品名称 DRUG_NAME
 @property (nonatomic,copy) NSString *drugName;
 //单位 UNITS
 @property (nonatomic,copy) NSString *units;
 //数量 AMOUNT
 @property (nonatomic,copy) NSString *amount;
 //方法 ADMINISTRATION
 @property (nonatomic,copy) NSString *method;
 */

@property (nonatomic,weak) UILabel *visitNoT;
@property (nonatomic,weak) UILabel *doctorT;
@property (nonatomic,weak) UILabel *depeNameT;
@property (nonatomic,weak) UILabel *drugNameT;
@property (nonatomic,weak) UILabel *unitsT;
@property (nonatomic,weak) UILabel *amountT;
@property (nonatomic,weak) UILabel *methodT;

@end

@implementation OuptPrescListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //药品名称
        UILabel *drugNameL = [Factory createLabelWithTitle:@"药品名称：" frame:CGRectMake(LeftDis, 5, Lab_W, Height) fontSize:LabFont];
        [self.contentView addSubview:drugNameL];
        UILabel *drugNameT = [[UILabel alloc] initWithFrame:CGRectMake(drugNameL.right, 5, kScreenW-20-Lab_W, Height )];
        drugNameT.font = kFont(TextFont);
        drugNameT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:drugNameT];
        self.drugNameT = drugNameT;
        
        //数量
        UILabel *amountLab = [Factory createLabelWithTitle:@"数量：" frame:CGRectMake(LeftDis, drugNameL.bottom, Text_W, Height) fontSize:LabFont];
        [self.contentView addSubview:amountLab];
        UILabel *amountT = [[UILabel alloc] initWithFrame:CGRectMake(amountLab.right, drugNameL.bottom, 30, Height)];
        amountT.font = kFont(TextFont);
        amountT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:amountT];
        self.amountT = amountT;
        //单位
        UILabel *unitsLab = [Factory createLabelWithTitle:@"单位：" frame:CGRectMake(amountT.right, drugNameT.bottom, Text_W, Height) fontSize:LabFont];

        [self.contentView addSubview:unitsLab];
        UILabel *unitsT = [[UILabel alloc] initWithFrame:CGRectMake(unitsLab.right, drugNameT.bottom, 30, Height)];
        unitsT.font = kFont(TextFont);
        unitsT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:unitsT];
        self.unitsT = unitsT;
        //方法
        UILabel *methodLab = [Factory createLabelWithTitle:@"服用方法：" frame:CGRectMake(unitsT.right, drugNameT.bottom, Lab_W, Height) fontSize:LabFont];

        [self.contentView addSubview:methodLab];
        UILabel *methodT = [[UILabel alloc] initWithFrame:CGRectMake(methodLab.right, drugNameT.bottom, Lab_W+20, Height)];
        methodT.font = kFont(TextFont);
        methodT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:methodT];
        self.methodT = methodT;
        //医生
        UILabel *doctorLab = [Factory createLabelWithTitle:@"医生：" frame:CGRectMake(LeftDis, amountLab.bottom, Text_W , Height) fontSize:LabFont];
        [self.contentView addSubview:doctorLab];
        UILabel *doctorT = [[UILabel alloc] initWithFrame:CGRectMake(doctorLab.right,  unitsT.bottom, Lab_W, Height)];
        doctorT.font = kFont(TextFont);
        doctorT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:doctorT];
        self.doctorT = doctorT;
        
        //科室
        UILabel *depeNameLab = [Factory createLabelWithTitle:@"科室：" frame:CGRectMake(doctorT.right+50, methodT.bottom, Text_W, Height) fontSize:LabFont];

        [self.contentView addSubview:depeNameLab];
        UILabel *depeNameT = [[UILabel alloc] initWithFrame:CGRectMake(depeNameLab.right, methodT.bottom, Lab_W*2, Height)];
        depeNameT.font = kFont(TextFont);
        depeNameT.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:depeNameT];
        self.depeNameT = depeNameT;
    }
    return self;
}
-(void)setPrescList:(OuptPrescListModel *)prescList{
    self.drugNameT.text = prescList.drugName;
    self.amountT.text = [NSString stringWithFormat:@"%@",prescList.amount];
    self.unitsT.text = prescList.units;
    self.methodT.text = prescList.method;
    self.doctorT.text = prescList.doctor;
    self.depeNameT.text = prescList.depeName;
}
+(OuptPrescListCell *)cellWithTableView:(UITableView *)tableView{
    static NSString *cellId = @"listCell";
    OuptPrescListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[OuptPrescListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
